<?php
class App_SourceType_Default extends Mozg_Source_Db
{
	protected $_tablePrefix = 'mozg';
	
    public function __construct ()
    {
    	$dbCreds = Mozg_Cfg::Get('global')->GetDb();

        try {

			$initCommand = "SET NAMES " .$dbCreds['charset']. ", time_zone = '" .Mozg::Lib('date')->getTimezoneOffset(). "'";
        	
	        parent::__construct('mysql:host=' .$dbCreds['host']. ';dbname=' .$dbCreds['name']. ';',
	                            $dbCreds['user'],
	                            $dbCreds['pass'],
	                            array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
	                                    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
	                                    PDO::MYSQL_ATTR_INIT_COMMAND => $initCommand));

        }
        catch (PDOException $e) {
		    echo "Ошибка при соединении с базой: " . $e->getMessage() . "\n";
		    exit;
        }
    }
}
    
